<?php

include_once('config.php');
include_once('model/friends.php');
include_once('model/status_messages.php');
include_once('model/friend_requests.php');

if (isset($_GET["id"]))
	$user_id = $_GET["id"];
else
	$user_id = Session::user()->id; //$_SESSION["user_id"] unta
	
$logged_in_user_id = Session::user()->id;

$data = array (
	"logged_in" 	=> Session::is_logged_in(),
	"contents" 		=> "wall_view.php",
	"user_id"		=> $user_id,
	
	//TODO: if $user_id != logged in user, check if they are friends, else true
	"is_friend"		=> Friends::are_friends_with($user_id, $logged_in_user_id),
	
	//TODO: check if there is pending request
	"has_request"   => FriendRequests::has_request($logged_in_user_id,$user_id),
	
	//TODO: get current status of user, status = "active" in db
	"current_status"=> StatusMessages::get_active_status($user_id),
	
	//TODO: get all status except current status of user
	"status_messages" => StatusMessages::get_all_old_status($user_id)
);


$index_view = new Template('layout.php',$data);
$index_view->render();

?>